fib = lambda n: 1 if n <= 2 else fib(n-1)+fib(n-2)
# print([fib(i) for i in range(1, 10)])
# 有一只青蛙, 它一次可以跳1格, 也可以跳2格. 它跳上N阶台阶有多少种跳法.
# 如果台阶为1: 1, 2: 2, 3: 3, 4: 5, 5: 8


from collections import Iterable


def func(items):
    for x in items:
        if isinstance(x, Iterable):
            yield from func(x)
        else:
            yield x


# 将下述嵌套列表转化为[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
items = [1, 2, [3, 4, [5, 6], 7], 8, 9, (10, 11), 12, [13], [14, 15]]

result = [x for x in func(items)]
# print(result)


def yie():
    yield from [1, 2, 3]

for y in yie():
    print(y)